package com.example.pipline.yu.activity;

import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

public class Pipeline {
    private final List<Node> nodes = new ArrayList<>();

    public Pipeline addNode(Node node) {
        nodes.add(node);
        return this;
    }

    @Transactional(rollbackFor = Exception.class)
    public void execute() throws Exception {
        for (Node node : nodes) {
            node.execute();
        }
    }
}